package com.xveshe.admin.service.impl;

import java.util.List;
import java.util.UUID;

import com.xveshe.common.utils.DateUtils;
import com.xveshe.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xveshe.admin.mapper.XsglGwxxMapper;
import com.xveshe.admin.domain.XsglGwxx;
import com.xveshe.admin.service.IXsglGwxxService;

/**
 * 岗位信息Service业务层处理
 *
 * @author geyasong
 * @date 2024-11-04
 */
@Service
public class XsglGwxxServiceImpl implements IXsglGwxxService
{
    @Autowired
    private XsglGwxxMapper xsglGwxxMapper;

    /**
     * 查询岗位信息
     *
     * @param id 岗位信息主键
     * @return 岗位信息
     */
    @Override
    public XsglGwxx selectXsglGwxxById(String id)
    {
        return xsglGwxxMapper.selectXsglGwxxById(id);
    }

    /**
     * 查询岗位信息列表
     *
     * @param xsglGwxx 岗位信息
     * @return 岗位信息
     */
    @Override
    public List<XsglGwxx> selectXsglGwxxList(XsglGwxx xsglGwxx)
    {
        return xsglGwxxMapper.selectXsglGwxxList(xsglGwxx);
    }

    /**
     * 新增岗位信息
     *
     * @param xsglGwxx 岗位信息
     * @return 结果
     */
    @Override
    public int insertXsglGwxx(XsglGwxx xsglGwxx)
    {   xsglGwxx.setId(UUID.randomUUID().toString());
        //获取用户账号xsglXslb.setCreator(SecurityUtils.getUsername());
        //获取用户昵称
        xsglGwxx.setCreator(SecurityUtils.getLoginUser().getUser().getNickName());
        xsglGwxx.setCreatedate(DateUtils.getNowDate());
        return xsglGwxxMapper.insertXsglGwxx(xsglGwxx);
    }

    /**
     * 修改岗位信息
     *
     * @param xsglGwxx 岗位信息
     * @return 结果
     */
    @Override
    public int updateXsglGwxx(XsglGwxx xsglGwxx)
    {
        xsglGwxx.setLastmodifier(SecurityUtils.getLoginUser().getUser().getNickName());
        xsglGwxx.setLastmodifieddate(DateUtils.getNowDate());
        return xsglGwxxMapper.updateXsglGwxx(xsglGwxx);
    }

    /**
     * 批量删除岗位信息
     *
     * @param ids 需要删除的岗位信息主键
     * @return 结果
     */
    @Override
    public int deleteXsglGwxxByIds(String[] ids)
    {
        return xsglGwxxMapper.deleteXsglGwxxByIds(ids);
    }

    /**
     * 删除岗位信息信息
     *
     * @param id 岗位信息主键
     * @return 结果
     */
    @Override
    public int deleteXsglGwxxById(String id)
    {
        return xsglGwxxMapper.deleteXsglGwxxById(id);
    }
}
